/**
 * jQuery.support.windowsTheme
 * Copyright (c) 2010 Mikhail Koryak - http://notetodogself.blogspot.com
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 * Date: 02/03/10
 *
 * @projectDescription Detect which windows theme is being used, 'xp' or 'classic'.
 *
 * jQuery.support.windowsTheme will contain values 'xp', 'classic', or undefined if theme could not be detected
 *
 * http://notetodogself.blogspot.com
 * Works with jQuery 1.3.2+. Tested on FF3.6, FF3.0, IE6, IE7 on WinXP.
 *
 * @author Mikhail Koryak
 * @version 0.2
 */

;(function($){
$.support.windowsTheme = (function () {
		var rgb;
		var map = { "rgb(212,208,200)" : "classic",
						"rgb(236,233,216)" : "xp" };
		var $elem = $("<button>");
		$elem.css("backgroundColor", "ButtonFace");
		$("body").append($elem);
		var elem = $elem.get(0);
		if (document.defaultView && document.defaultView.getComputedStyle) {
			s = document.defaultView.getComputedStyle(elem, "");
			rgb = s && s.getPropertyValue("background-color");
		} else if (elem.currentStyle) {
		rgb = (function (el) { // get a rgb based color on IE
		var oRG =document.body.createTextRange();
		oRG.moveToElementText(el);
		var iClr=oRG.queryCommandValue("BackColor");
			return "rgb("+(iClr & 0xFF)+","+((iClr & 0xFF00)>>8)+","+
						((iClr & 0xFF0000)>>16)+")";
		})(elem);
		} else if (elem.style["backgroundColor"]) {
			rgb = elem.style["backgroundColor"];
		} else  {
			rgb = null;
		}
		$elem.remove();
		rgb = rgb.replace(/[ ]+/g,"");
		if(rgb){
			return map[rgb];
		}
	})();
})(jQuery);
	